---
title: Dot Pattern
date: 2023-07-20
description: A background dot pattern made with SVGs, fully customizable using Tailwind CSS.
author: dillionverma
published: true
video: https://cdn.magicui.design/dot-pattern.mp4
---

<ComponentPreview name="dot-pattern-demo" />

## Installation

<Tabs defaultValue="cli">

<TabsList>
  <TabsTrigger value="cli">CLI</TabsTrigger>
  <TabsTrigger value="manual">Manual</TabsTrigger>
</TabsList>
<TabsContent value="cli">

```bash
npx shadcn@latest add @magicui/dot-pattern
```

</TabsContent>

<TabsContent value="manual">

<Steps>

<Step>Copy and paste the following code into your project.</Step>

<ComponentSource name="dot-pattern" />

<Step>Update the import paths to match your project setup.</Step>

</Steps>

</TabsContent>

</Tabs>

## Examples

### Linear Gradient

<ComponentPreview name="dot-pattern-linear-gradient" />

### With Glow Effect

<ComponentPreview name="dot-pattern-with-glow-effect" />

### Usage

```tsx showLineNumbers
import { DotPattern } from "@/components/ui/dot-pattern"
```

```tsx showLineNumbers
<div className="relative h-[500px] w-full overflow-hidden">
  <DotPattern />
</div>
```

## Props

### Dot Pattern

| Prop        | Type      | Default | Description                                  |
| ----------- | --------- | ------- | -------------------------------------------- |
| `width`     | `any`     | `16`    | Width of the dot pattern                     |
| `height`    | `any`     | `16`    | Height of the dot pattern                    |
| `x`         | `any`     | `0`     | X position of the dot                        |
| `y`         | `any`     | `0`     | Y position of the dot                        |
| `cx`        | `any`     | `1`     | X position of the circle                     |
| `cy`        | `any`     | `1`     | Y position of the circle                     |
| `cr`        | `any`     | `1`     | Radius of the circle                         |
| `className` | `string`  | `-`     | Class name of the dot pattern                |
| `glow`      | `boolean` | `false` | Activates the glow effect in the dot pattern |
